<?php
/**
 *	@name		论坛广告
 *	@author		Jeffery
 *	@qq			1017756891
 *	@email		1017756891@qq.com
 *	@website	http://www.iweitao.net
**/
require_once "core.php";

class plugin_weitaoad {

	
	function plugin_weitaoad() {
		global $_G;
	}
	
	function checkopen($identify) {
		global $_G;
		if(!$_G['cache']['plugin']['weitaoad']['open']) { //全局插件关闭
			return false;
		}
		if($_G['cache']['plugin']['weitaoad'][$identify]) {
			return true;
		} else {
			return false;
		}
	}
	
	function checkcookie($identify) {
		global $_G;
		$setcookie = $_G['cache']['plugin']['weitaoad']['setcookie'];
		$opencookie = $_G['cache']['plugin']['weitaoad']['opencookie'];
		if($opencookie) {
			return true;
		}
		if(getcookie("weitaoad_".$identify)) {
			return false; 
		} else {
			$time = $setcookie*24*60*60;
			dsetcookie("weitaoad_".$identify,'TURE',$time);
			return true;
		}
		
	}
	
	
	function global_header() {
		global $_G;
		$headerlink = $_G['cache']['plugin']['weitaoad']['headerlink'];
		if(!$this->checkopen('header')) {
			return false;
		}
		if(!$this->checkcookie('header')) {
			return false;
		}
		include template("weitaoad:header");
		return $return;
	}
	
	function global_footer() {
		global $_G;
		$footerlink = $_G['cache']['plugin']['weitaoad']['footerlink'];
		if(!$this->checkopen('footer')) {
			return false;
		}
		if(!$this->checkcookie('footer')) {
			return false;
		}
		include template("weitaoad:footer");
		return $return;
	}
}
class plugin_weitaoad_forum extends plugin_weitaoad {
	
}
?>